<template>
    <div id="Detail">
        <v-details :detailData="data.detailData" :inputConfig="inputConfig" :rules="rules" @pop="setdata"></v-details>
    </div>
</template>

<script>

import details from 'commons/Detail'
import baseMixin from "@/mixins/BaseMixin";

export default {
    name: "AsnDetails",
    mixins: [baseMixin],
    props: {
        data: {
            type: Object
        }
    },
    data() {
        return {
            uom: "uom",
            rules: {
                stepnumber: [
                    {required: true, message: "步骤号不能为空", trigger: 'blur'},
                ],
                patype: [
                    {required: true, message: "请选择上架类型", trigger: 'blur'},
                ],
            },
        }
    },
    computed: {
        inputConfig() {
            let uom = "";
            if (this.data.detailData.uom === "") {
                uom = 'uom';
            } else {
                uom = this.data.detailData.uom;
            }
            return [
                [
                    {
                        type: "input",
                        label: this.$t('outbound.stepnumber'),
                        props: "stepnumber",
                    },
                    {
                        type: "select",
                        label: this.$t('config.measureUnit'),
                        props: "uom",
                        options: this.getOptions('querycodeLkup/TMUOM')
                    },
                    {
                        type: "input",
                        label: this.$t('common.desc'),
                        props: "descr",
                    },
                    {
                        type: "select",
                        label: this.$t('outbound.locationtypeoverride'),
                        props: "locationtypeoverride",
                        options: this.getOptions('querycodeLkup/LOCTYPE')
                    },
                ],
                [
                    {
                        type: "select",
                        label: this.$t('outbound.locallocationsort'),
                        props: "locallocationsort",
                        options: this.getOptions('querycodeLkup/ALLOCSORT')
                    },
                    {
                        type: "input",
                        label: this.$t('outbound.computeduom'),
                        props: "uom",
                    },
                    {
                        type: "select",
                        label: this.$t('outbound.locationtypeoverridestripe'),
                        props: "locationtypeoverridestripe",
                        options: this.getOptions('querycodeLkup/YESNO')
                    },
                ],
                [
                    {
                        type: "select",
                        label: this.$t('outbound.locationcategoryoverride'),
                        props: "locationcategoryoverride",
                        options: this.getOptions('querycodeLkup/LOCCATEGRY'),
                    },
                    {
                        type: "table",
                        label: this.$t('outbound.pickcode'),
                        props: "pickcode",
                        tableConfig: [
                            {
                                label: this.$t('outbound.pickcode'),
                                prop: "strategypickcode",
                                input: "input",
                            },
                            {
                                label: this.$t('outbound.strategycode'),
                                prop: "strategycode",
                                input: "input",
                            },
                            {
                                label: this.$t('common.desc'),
                                prop: "description",
                                input: "input",
                            },
                        ],
                        url: `/queryPackCode/ALLOC/${uom}/?/${this.$store.state.wms}`
                    },
                    {
                        type: "select",
                        label: this.$t('outbound.groupuompicks'),
                        props: "groupuompicks",
                        options: this.getOptions("querycodeLkup/YESNO")
                    },
                ]
            ]
        }
    },
    methods: {
        setdata(data, id, close) {
            this.data.detailData.pickcode = data.strategypickcode;
            close(false);
        }
    },
    mounted() {
    },
    watch: {},
    components: {
        'v-details': details
    }
}
</script>

<style scoped>

</style>
